//
//  PreferenceController.m
//  PrefWindow
//
//  Created by Stéphane Delval on 01/07/11.
//  Copyright 2011 BiwiLabs software. All rights reserved.
//

#import "PreferenceController.h"

@implementation PreferenceController

-(id)init
{
    if (![super initWithWindowNibName:@"Preferences"])
        return nil;

    return self;
}


/*- (id)initWithWindow:(NSWindow *)window
{
    self = [super initWithWindow:window];
    if (self)
    {
        // Initialization code here.
    }
    return self;
}*/

/*- (void)dealloc
{
    //[super dealloc];
}*/

- (void)windowDidLoad
{
    [super windowDidLoad];
    // Restore the value read in the preferences file into the window's text field
    [numberOfDigitsAfterDecimal setIntegerValue:[[NSUserDefaults standardUserDefaults]
                                  integerForKey:@"nrOfDigitsAfterDecimal"]];

    //NSLog(@"Pref Window did load!"); // *** DEBUG ***

    // Implement this method to handle any initialization after your window
    // controller's window has been loaded from its nib file.
}

- (IBAction)preferenceHasBeenRecorded:(id)sender
{
    [[NSUserDefaults standardUserDefaults] setInteger:[numberOfDigitsAfterDecimal integerValue]
                                               forKey:@"nrOfDigitsAfterDecimal"];

    //NSLog(@"Preference value has been saved!!"); // *** DEBUG ***
}

@end